import { useRoute, RouteLocationNormalized } from "vue-router";
import { watch } from "vue";
import { useCommonStore } from "@/store/modules/common";

export default function useWatchRoute() {
  const route = useRoute();
  const store = useCommonStore();

  watch(
    () => route,
    (val: RouteLocationNormalized) => {
      // console.log(val);
      store.SET_ROUTE(val.path);
    },
    { deep: true }
  );

  return {};
}
